import { Map } from "immutable";
const defaultState = Map({
  userInfo:{
    userName:"",
    telValue:'',
  },
  isLogin:false
});
export default (state = defaultState, action) => {
  switch (action.type){
    case 'changeTel':
      return state.setIn(['userInfo','telValue'],action.value)
    case 'changeUser':
      return state.setIn(['userInfo','userName'],action.value)
    case 'changeLogin':
      return state.setIn(['userInfo','userName'],action.value).set('isLogin',true)
    case 'saveState':
      return state.setIn(['userInfo','userName'],action.value.username).setIn(['userInfo','telValue'],action.value.tel)
    default:
      return state.set()
  }
}